
package io.fredia.femicro.gate.ratelimit.config.repository.springdata;

import io.fredia.femicro.gate.ratelimit.config.Rate;
import io.fredia.femicro.gate.ratelimit.config.repository.AbstractRateLimiter;
import lombok.RequiredArgsConstructor;

/**
 * 查询类
 * 
 * @author : Fredia
 * @since : 2018年3月12日
 * @version : v1.0.0
 */
@RequiredArgsConstructor
public class SpringDataRateLimiter extends AbstractRateLimiter {

    private final IRateLimiterRepository repository;

    @Override
    protected Rate getRate(String key) {
        return this.repository.findById(key).get();
    }

    @Override
    protected void saveRate(Rate rate) {
        this.repository.save(rate);
    }

}
